package cloudUser.service.impl;

import cloudEntity.dto.user.SmartPermissionInsertDTO;
import cloudEntity.dto.user.SmartPermissionUpdateDTO;
import cloudEntity.entity.SmartPermissionEntity;
import cloudEntity.vo.PageBeanVO;
import cloudEntity.vo.user.SmartRolePermissionVO;
import cloudEntity.vo.user.SmartUserVO;
import cloudUser.mapper.SmartPermissionMapper;
import cloudUser.service.SmartUserPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: Smart School
 * @ClassName SmartUserPermissionServiceImpl
 * @description:
 * @author: 陈智博
 * @create: 2025-05-16 17:26
 * @Version 1.0
 **/
@Service
public class SmartUserPermissionServiceImpl implements SmartUserPermissionService {

    @Autowired
    private SmartPermissionMapper smartPermissionMapper;


    @Override
    public PageBeanVO<SmartPermissionEntity> GetPermissionByPage(Integer pageNum, Integer pageSize) {
        Integer pageBean = (pageNum - 1) * pageSize;
        Integer countSize = smartPermissionMapper.getPermissionCount();
        List<SmartPermissionEntity> smartPermissionPageInfo = smartPermissionMapper.getSmartPermissionPageInfo(pageBean, pageSize);
        return new PageBeanVO<>(pageNum,pageSize,countSize,smartPermissionPageInfo);
    }

    @Override
    public Integer InsertPermission(SmartPermissionInsertDTO smartPermissionInsertDTO) {
        return smartPermissionMapper.InsertPermission(smartPermissionInsertDTO);
    }

    @Override
    public Integer UpdatePermission(SmartPermissionUpdateDTO smartPermissionUpdateDTO) {
        return smartPermissionMapper.UpdatePermission(smartPermissionUpdateDTO);
    }

    @Override
    public Integer DeletePermission(Integer ids) {
        return smartPermissionMapper.DeletePermission(ids);
    }
}
